package org.misty.java.first;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintWriter;

/**
 * Created by Misty on 2015/6/9.
 */
public class JavaApp extends Application {
    static long start;
    static long end;

    @Override
    public void start(Stage primaryStage) throws Exception {
        Scene scene = new Scene(new StackPane(new Label("Loading")), 400, 300);
        primaryStage.setTitle("Java JavaFX Application");
        primaryStage.setScene(scene);
        primaryStage.show();

        end = System.currentTimeMillis();

        long total = end - start;
        System.out.println(total);

        File file = new File("java.txt");
        try (PrintWriter pw = new PrintWriter(new FileOutputStream(file, true))) {
            pw.append(total + "\n");
        }
    }

    public static void main(String[] args) {
        start = System.currentTimeMillis();
        launch(JavaApp.class, args);
    }
}
